<template>
  <div >
    <button @click="showStudentInfos">获取学生信息</button>
    <button @click="showCarInfos">获取汽车信息</button>
  </div>
</template>

<script>
  // 引入组件 
  import axios from 'axios' 

  export default {
    name:'App',
    methods: {
      showStudentInfos(){
        axios.get('http://localhost:8080/lingchen/students').then(
          response => {
            console.log('请求成功了', response.data)
          },
          error => {
            console.log('请求失败了', error.message)
          }
        )
      },
      showCarInfos(){
        axios.get('http://localhost:8080/lc/cars').then(
          response => {
            console.log('请求成功了', response.data)
          },
          error => {
            console.log('请求失败了', error.message)
          }
        )
      }
    },
  }
</script>